package com.usian.controller;

import com.usian.pojo.TbContentCategory;
import com.usian.service.ContentCategoryService;
import com.usian.utils.PageResult;
import com.usian.utils.Result;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @Author lpf
 * @Date 2022/3/24 上午11:55
 * @ProjectName java134-e-commerce-project
 * @Version 1.0
 * @Description:
 */
@RestController
@RequestMapping(value = "service/contentCategory")
public class ContentCategoryController {

    @Autowired
    private ContentCategoryService contentCategoryService;

    /**
     * 内容分类查询接口
     * @param id
     * @return
     * @Auth lpf
     */
    @RequestMapping(value = "selectContentCategoryByParentId")
    public List<TbContentCategory> selectContentCategoryByParentId(Long id){
        return contentCategoryService.selectContentCategoryByParentId(id);
    }

    /**
     * 内容分类管理添加接口
     * @param tbContentCategory
     * @return
     * @Auth lpf
     */
    @RequestMapping(value = "insertContentCategory", method = RequestMethod.POST)
    public Integer insertContentCategory(@RequestBody TbContentCategory tbContentCategory){
        return contentCategoryService.insertContentCategory(tbContentCategory);
    }

    /**
     * 根据id删除内容管理
     * @param categoryId
     * @return
     * @Auth fgg
     */
    @RequestMapping(value = "deleteContentCategoryById",method = RequestMethod.POST)
    public Integer deleteContentCategoryById(@RequestParam("categoryId") Long categoryId){
        return contentCategoryService.deleteContentCategoryById(categoryId);
    }
}
